<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<head>

</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 业务管理 <span class="c-gray en">&gt;</span> 系统参数 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>

<article class="page-container">
	<div class="cl pd-5 bg-1 bk-gray">
		<!-- 搜索栏 -->
		<div class="row">
			<label class="form-label col-xs-1">类型:</label>
			<div class="formControls col-xs-3">
				<span>
					<select id="type" class="select"></select>
				</span>
			</div>
			<label class="form-label col-xs-1">名称:</label>
			<div class="formControls col-xs-3">
				<input type="text" class="input-text" id="codeValue" name="codeValue" />
			</div>
			<div class="formControls col-xs-3 text-r">
				<a href="javascript:query();" class="btn btn-success radius"><i class="Hui-iconfont">&#xe665;</i> 查询</a>
				<a href="javascript:void(0);" onclick="reset(this)" class="btn btn-secondary radius"><i class="Hui-iconfont">&#xe665;</i> 重置</a>
			</div>
		</div>

	</div>

	<div class="cl pd-5 bg-1 bk-gray mt-5">
		<span class="l">
			<a href="javascript:;" onclick="layer_show('添加','${ctx}/code/findOne','800','400')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加</a>
 		</span>
	</div>

	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-sort">
			<thead>
				<tr class="text-c">
					<th width="25">序号</th>
					<th width="50">类型</th>
					<th width="100">名称</th>
					<th width="100">内容</th>
					<th width="150">备注</th>
					<!-- <th width="60">状态</th> -->
					<th width="130">修改时间</th>
					<th width="60">操作</th>
				</tr>
			</thead>
		</table>
	</div>
</article>
<script type="text/javascript">
var datatable = null;
$(function(){
	var select = "${fns:getDictList('sys_code')}"
	select=select.replace('[', '').replace(']', '').split(",");
	$("#type").append("<option value=''>请选择</option>")
	for(var i=0;i<select.length;i++){
		var opt = "<option value='"+select[i].split(':')[1]+"'>"+select[i].split(":")[0]+"</option>";
		$("#type").append(opt)
	}

	datatable = $('.table-sort').DataTable({
		pagingType: "input",
		"sScrollX": "100%",  
		"sScrollXInner": "100%",  
		"bScrollCollapse": true,
		ordering:false,
		ajax: {
			url: "${ctx}/code/queryByPage",
			type: 'post',
			data: function(d) {
                d.search_LIKE_type = $("#type").val();
                d.search_LIKE_codeValue = $("#codeValue").val();
            }
		},
		fnDrawCallback:function(oSettings){//表格画完的回调函数
			var obj = oSettings.json.otherData;
        },
		columns: [{
			"data": null,
			"class": "text-c",
			"render":function(data, type, row, meta){
				return  meta.row + 1;
			}
		},{
			"data": "type",
			"defaultContent": "",
			"class": "text-c",
			"render" : function (data, type, row, meta) {
				return getDictLabel(${fns:getDictListJson('sys_code')}, data, '未知');
            }
		},{
			"data": "codeName",
			"defaultContent": "",
			"class": "text-c",
			"render" : function (data, type, row, meta) {
				return data;
            }
		},{
			"data": "codeValue",
			"defaultContent": "",
			"class": "text-c",
			"render" : function (data, type, row, meta) {
                if(row.type==getDictValue(${fns:getDictListJson('sys_code')},'水印', '')){
                    var img = "<img style='width:50px;' src='"+data+"'/>";
                    return img;
                }else if(row.type==getDictValue(${fns:getDictListJson('sys_code')},'系统参数', '')){
                    return abbr(data,70);
                }else if(row.type==getDictValue(${fns:getDictListJson('sys_code')},'视频直播开关', '')){
                   if(data==0){
                       return "关";
                   }else {
                       return "开";
                   }
                }else if(row.type==getDictValue(${fns:getDictListJson('sys_code')},'平台抽成', '')){
                    return data+"%";
                }else if(row.type==getDictValue(${fns:getDictListJson('sys_code')},'会员', '')){
                    return data+"%";
                }else {
                    return data;
                }
            }
		}, {
            "data": "remarks",
            "defaultContent": "",
            "class": "text-c"
        },{
            "data": "updateDate",
            "defaultContent": "",
            "class": "text-c"
        },{
            "data": null,
            "class": "text-c",
            render: function(data, type, row, meta) {
                var btns = new Array();
                btns[btns.length] = butInfo("&#xe6df;","编辑","layer_show('编辑','${ctx}/code/findOne.do?id="+row.id+"','800','400')");
				 btns[btns.length] = butInfo("&#xe6e2;","删除","delEntity('${ctx}/code/deleteEntity.do','"+row.id+"',true)");
                return getDTOperateBtn(btns);
            }
        }],
		initComplete:function(data){
		}
	});
})

</script>
</body>
